

import { Comp } from "../m/CompDef";
import { GpEntity } from "./GpEntity";
import GpHeroHud from "./GpHeroHud";
import { Vect3 } from "../../common/MathUtils";

import { _decorator, Component, Node,Color } from 'cc';
import { BaseComponent } from "../../../../extensions/cocos-scaffold-3x/assets/ui/base/BaseComponent";
const { ccclass, property } = _decorator;

@ccclass
export default class GpBuilding extends BaseComponent {

    @property(GpHeroHud)
    gpHeroHud: GpHeroHud = null;

    colorArr = [
        new Color(255, 0, 0),
        new Color(0, 255, 0),
        new Color(0, 0, 255),
    ]

    entity: GpEntity


    onInit(): void {
        // this.entity = this.node.getComponent(GpEntity)
        // const ecsEntity = this.entity.ecsEntity
        // const force = ecsEntity.component(Comp.Force)

        // this.entity.renderRoot.color = this.colorArr[(this.colorArr.length - 1) % (this.colorArr.length - 1 + force.value)]
        // this.entity.renderRoot.setContentSize(this.entity.transform.radius * 2, this.entity.transform.radius * 2)

        this.setupHud()
    }

    onEnable() {
    }

    setupHud() {
    }

    protected onDisable(): void {
    }

    protected update(dt: number): void {
    }

}
